package com.hcy.springcloud.controller;

//import com.hcy.springcloud.entities.CommonResult;
//import com.hcy.springcloud.entities.Payment;
//import com.hcy.springcloud.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@Slf4j
public class OrderNacosController {

//        public static final String SERVER_URL="http://nacos-payment-provider";
    @Resource
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String serverURL;

//    @Resource
//    private PaymentFeignService paymentFeignService;

        @GetMapping(value = "/consumer/payment/nacos/{id}")
    public String paymentInfo(@PathVariable("id") Long id) {
        return restTemplate.getForObject(serverURL + "/payment/nacos/" + id, String.class);
    }
//    @GetMapping("/consumer/payment/feign/nacos/{id}")
//    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id) {
//        return paymentFeignService.getPaymentById(id);
//    }


}
